/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author HuyNVK
 */
@Entity
@Table(name = "DEFECTLOG")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Defectlog.findAll", query = "SELECT d FROM Defectlog d"),
    @NamedQuery(name = "Defectlog.findByLogID", query = "SELECT d FROM Defectlog d WHERE d.logID = :logID"),
    @NamedQuery(name = "Defectlog.findByTitle", query = "SELECT d FROM Defectlog d WHERE d.title = :title"),
    @NamedQuery(name = "Defectlog.findByDescription", query = "SELECT d FROM Defectlog d WHERE d.description = :description"),
    @NamedQuery(name = "Defectlog.findByCreatedDate", query = "SELECT d FROM Defectlog d WHERE d.createdDate = :createdDate"),
    @NamedQuery(name = "Defectlog.findByProduct", query = "SELECT d FROM Defectlog d WHERE d.product = :product"),
    @NamedQuery(name = "Defectlog.findByDeadline", query = "SELECT d FROM Defectlog d WHERE d.deadline = :deadline"),
    @NamedQuery(name = "Defectlog.findByCorrectiveAction", query = "SELECT d FROM Defectlog d WHERE d.correctiveAction = :correctiveAction"),
    @NamedQuery(name = "Defectlog.findByFixedDate", query = "SELECT d FROM Defectlog d WHERE d.fixedDate = :fixedDate"),
    @NamedQuery(name = "Defectlog.findByClosedDate", query = "SELECT d FROM Defectlog d WHERE d.closedDate = :closedDate")})
public class Defectlog implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "LogID")
    private Integer logID;
    @Basic(optional = false)
    @Column(name = "Title")
    private String title;
    @Basic(optional = false)
    @Column(name = "Description")
    private String description;
    @Basic(optional = false)
    @Column(name = "CreatedDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdDate;
    @Basic(optional = false)
    @Column(name = "Product")
    private String product;
    @Column(name = "Deadline")
    @Temporal(TemporalType.TIMESTAMP)
    private Date deadline;
    @Column(name = "CorrectiveAction")
    private String correctiveAction;
    @Column(name = "FixedDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fixedDate;
    @Column(name = "ClosedDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date closedDate;
    @JoinColumn(name = "SeverityID", referencedColumnName = "SeverityID")
    @ManyToOne(optional = false)
    private Severity severityID;
    @JoinColumn(name = "ProjectID", referencedColumnName = "ProjectID")
    @ManyToOne(optional = false)
    private Project projectID;
    @JoinColumn(name = "PriorityID", referencedColumnName = "PriorityID")
    @ManyToOne(optional = false)
    private Priority priorityID;
    @JoinColumn(name = "LogTypeID", referencedColumnName = "LogTypeID")
    @ManyToOne(optional = false)
    private Logtype logTypeID;
    @JoinColumn(name = "StatusID", referencedColumnName = "LogStatusID")
    @ManyToOne(optional = false)
    private Logstatus statusID;
    @JoinColumn(name = "FixedBy", referencedColumnName = "EmployeeID")
    @ManyToOne
    private Employee fixedBy;
    @JoinColumn(name = "AssignedTo", referencedColumnName = "EmployeeID")
    @ManyToOne
    private Employee assignedTo;
    @JoinColumn(name = "DefectedBy", referencedColumnName = "EmployeeID")
    @ManyToOne(optional = false)
    private Employee defectedBy;

    public Defectlog() {
    }

    public Defectlog(Integer logID) {
        this.logID = logID;
    }

    public Defectlog(Integer logID, String title, String description, Date createdDate, String product) {
        this.logID = logID;
        this.title = title;
        this.description = description;
        this.createdDate = createdDate;
        this.product = product;
    }

    public Integer getLogID() {
        return logID;
    }

    public void setLogID(Integer logID) {
        this.logID = logID;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public Date getDeadline() {
        return deadline;
    }

    public void setDeadline(Date deadline) {
        this.deadline = deadline;
    }

    public String getCorrectiveAction() {
        return correctiveAction;
    }

    public void setCorrectiveAction(String correctiveAction) {
        this.correctiveAction = correctiveAction;
    }

    public Date getFixedDate() {
        return fixedDate;
    }

    public void setFixedDate(Date fixedDate) {
        this.fixedDate = fixedDate;
    }

    public Date getClosedDate() {
        return closedDate;
    }

    public void setClosedDate(Date closedDate) {
        this.closedDate = closedDate;
    }

    public Severity getSeverityID() {
        return severityID;
    }

    public void setSeverityID(Severity severityID) {
        this.severityID = severityID;
    }

    public Project getProjectID() {
        return projectID;
    }

    public void setProjectID(Project projectID) {
        this.projectID = projectID;
    }

    public Priority getPriorityID() {
        return priorityID;
    }

    public void setPriorityID(Priority priorityID) {
        this.priorityID = priorityID;
    }

    public Logtype getLogTypeID() {
        return logTypeID;
    }

    public void setLogTypeID(Logtype logTypeID) {
        this.logTypeID = logTypeID;
    }

    public Logstatus getStatusID() {
        return statusID;
    }

    public void setStatusID(Logstatus statusID) {
        this.statusID = statusID;
    }

    public Employee getFixedBy() {
        return fixedBy;
    }

    public void setFixedBy(Employee fixedBy) {
        this.fixedBy = fixedBy;
    }

    public Employee getAssignedTo() {
        return assignedTo;
    }

    public void setAssignedTo(Employee assignedTo) {
        this.assignedTo = assignedTo;
    }

    public Employee getDefectedBy() {
        return defectedBy;
    }

    public void setDefectedBy(Employee defectedBy) {
        this.defectedBy = defectedBy;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (logID != null ? logID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Defectlog)) {
            return false;
        }
        Defectlog other = (Defectlog) object;
        if ((this.logID == null && other.logID != null) || (this.logID != null && !this.logID.equals(other.logID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Defectlog[ logID=" + logID + " ]";
    }
    
}
